package ch.idsia.ai.agents.controllers.myai;

/**
 * Created by IntelliJ IDEA.
 * User: blakekl10
 * Date: Jun 7, 2010
 * Time: 2:50:10 PM
 * To change this template use File | Settings | File Templates.
 */
public class Element implements Comparable{

    private int[] location1 = new int[2];
    private int[] location2 = new int[2];
    protected static int idNumber = 0;
    private int id;

    public Element()
    {
        this(0,0,0,0);
    }

    public Element (int x1, int y1, int x2, int y2)
    {
        location1[0] = x1;
        location1[1] = y1;
        location2[0] = x2;
        location2[1] = y2;
        id = ++idNumber;
    }

    public int[] getLocation()
    {
        int[] distance = new int[2];
        distance[0] = location1[0]  - 11;
        distance[1] = location1[1]  - 11;

        return distance;
    }


    public int getDistance()
    {
        return location1[0] - 11;
    }


    public int getHeight()
    {
        return (location1[1] - 11) * -1;
    }
    
    public String getName()
    {
        return this.getClass().getName();
    }

    public int compareTo(Object o)
    {
        Element target = (Element) o;
        int result = 0;
        
        if (this.getLocation()[0] < target.getLocation()[0])
            result = -1;
        else if (this.getLocation()[0] == target.getLocation()[0])
            result = 0;
        else
            result = 1;

        return result;
    }
}
